#include "cstate.h"

CState::CState()
{
    this->Events=new QList<CEvent *>();
     this->ResEventCount=0;
    this->NoResEventCount = 0;
}
CState::CState(QString stateName,QString stateType,QString description){
    this->Events=new QList<CEvent *>();
    this->StateName=stateName;
    this->StateType=stateType;
    this->StateDescription=description;
}

void CState::setStateName(QString stateName){
    this->StateName=stateName;
}

void CState::setStateType(QString stateType){
    this->StateType=stateType;
}

void CState::setStateDescription(QString description){
    this->StateDescription=description;
}

QString CState::getStateName(){
    return this->StateName;
}

QString CState::getStateType(){
    return this->StateType;
}

QString CState::getStateDescription(){
    return this->StateDescription;
}

bool CState::addEvent(CEvent *event){

    this->Events->append(event);
    if(event->getEventType()=="response"){
        this->ResEventCount+=1;
    }else if(event->getEventType()=="noresponse"){
         this->NoResEventCount +=1;
    }
    return true;
}

CEvent * CState::getEvent(int index){
    return this->Events->at(index);
}
int CState::getCount(){
   return  this->Events->count();
}

int CState::getResEventCount(){
    return this->ResEventCount;
}

int CState::getNoResEventCount(){
    return this->NoResEventCount;
}

